import 'package:flutter_elf/_base/common_list.dart';
import 'package:flutter_elf/base/base_page_state.dart';
/// CreateTime 2020/4/22 9:55
/// CreateUser chen 
/// ProjectName flutter_elf
import 'package:flutter_elf/config/component_index.dart';
import 'package:flutter_elf/model/gank_io_girl_response.dart';
import 'package:flutter_elf/network/service/gank_io_service.dart';

class GankIO2Page extends StatefulWidget{
  @override
  State<StatefulWidget> createState() {
    // TODO: implement createState
    return GankIO2PageState();
  }
}

class GankIO2PageState extends BasePageState<GankIO2Page>{

  @override
  Widget build(BuildContext context) {
    Widget list = CommonListPage<WidgetItem2,GankIOGirlResponse,GankIOGirlData> (
      getItem: (dynamic info){
        return WidgetItem2<GankIOGirlData>(info);
      },
      limit: 20,
      futureData: (int page){
        return futureData(page);
      },
    );
    // TODO: implement build
    return Scaffold(
      appBar: AppBarCreator.create(context, '干货2'),
      body: Column(
        children: <Widget>[
          Text('my text'),
          Expanded(
            child: list,
          ),
        ],
      ),
    );
  }


  Future<GankIOGirlResponse> futureData(int page){
    return GankIOService.getCategory(page, state: this);
  }
}
class WidgetItem2<GankIOGirlData> extends StatelessWidget{
  final GankIOGirlData m ;

  WidgetItem2(this.m);

  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return Text('${m.toString()}',maxLines: 1,);
  }
}